home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / ConditionalMacros.a < prev    next >
Text File  |  1996-05-01  |  10KB  |  229 lines

  1. ;
  2. ;    File:        ConditionalMacros.a
  3. ;
  4. ;    Contains:    Set up for compiler independent conditionals
  5. ;
  6. ;    Version:    Technology:    Universal Interface Files 3.0dx
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
  19. __CONDITIONALMACROS__ SET 1
  20.  
  21. ;
  22. ;***************************************************************************************************
  23. ;    UNIVERSAL_INTERFACES_VERSION
  24. ;    
  25. ;        0x0300 => version 3.0
  26. ;        0x0210 => version 2.1
  27. ;        This conditional did not exist prior to version 2.1
  28. ;***************************************************************************************************
  29. ;
  30. UNIVERSAL_INTERFACES_VERSION EQU $0300
  31. ;
  32. ;***************************************************************************************************
  33. ;    GENERATINGPOWERPC        - Compiler is generating PowerPC instructions
  34. ;    GENERATING68K            - Compiler is generating 68k family instructions
  35. ;
  36. ;        Invariant:
  37. ;            GENERATINGPOWERPC != GENERATING68K
  38. ;***************************************************************************************************
  39. ;
  40.     IF &TYPE('PowerAsm') <> 'UNDEFINED' THEN
  41.     GENERATINGPOWERPC: SET 1
  42.     GENERATING68K: SET 0
  43.     ELSE
  44.     GENERATINGPOWERPC: SET 0
  45.     GENERATING68K: SET 1
  46.     ENDIF
  47. ;
  48. ;***************************************************************************************************
  49. ;    GENERATING68881            - Compiler is generating mc68881 floating point instructions
  50. ;    
  51. ;        Invariant:
  52. ;            GENERATING68881 => GENERATING68K
  53. ;***************************************************************************************************
  54. ;
  55.     IF &TYPE('GENERATING68881') = 'UNDEFINED' THEN
  56.     GENERATING68881: SET 0
  57.     ENDIF
  58. ;
  59. ;***************************************************************************************************
  60. ;    GENERATINGCFM            - Code being generated assumes CFM calling conventions
  61. ;    CFMSYSTEMCALLS            - No A-traps.  Systems calls are made using CFM and UPP's
  62. ;
  63. ;        Invariants:
  64. ;            GENERATINGPOWERPC => GENERATINGCFM
  65. ;            GENERATINGPOWERPC => CFMSYSTEMCALLS
  66. ;            CFMSYSTEMCALLS => GENERATINGCFM
  67. ;***************************************************************************************************
  68. ;
  69.     GENERATINGCFM:  SET GENERATINGPOWERPC
  70.     CFMSYSTEMCALLS:  SET GENERATINGPOWERPC
  71.     IF GENERATING68K THEN
  72.         IF &TYPE('&SYSMODEL') <> 'UNDEFINED' THEN
  73.             IF &SYSMODEL = '__CFM68K__' THEN
  74.                 GENERATINGCFM: SET 1
  75.                 CFMSYSTEMCALLS: SET 1
  76.             ENDIF
  77.         ENDIF
  78.     ENDIF
  79. ;
  80. ;***************************************************************************************************
  81. ;    One or none of the following BUILDING_~= conditionals is expected to be set during 
  82. ;    compilation (e.g. MrC -d BUILDING_FOR_SYSTEM7), the others should be left undefined.
  83. ;    If none is set, BUILDING_FOR_SYSTEM7_AND_SYSTEM8 is used.
  84. ;    
  85. ;        BUILDING_FOR_SYSTEM7                - Code is intended to run on System 7.x machine or earlier .
  86. ;        BUILDING_FOR_SYSTEM7_AND_SYSTEM8    - Code is intended to run on System 7 or Copland.
  87. ;        BUILDING_FOR_SYSTEM8                - Code is intended to run on Copland only.
  88. ;        BUILDING_PREEMPTIVE_CODE            - Code is intended to run as Copland server or driver.
  89. ;        
  90. ;    The following conditionals are set up based on which of the BUILDING_~= flag (above) was specified.
  91. ;    They are used in throughout the interface files to conditionalize declarations.
  92. ;    
  93. ;        FOR_SYSTEM7_ONLY                    - In System 7. Not in Copland.
  94. ;        FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED    - In System 7. Works in Copland, but there is a better way.
  95. ;        FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE    - In System 7. In Copland, but only for cooperative tasks.
  96. ;        FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE    - In System 7. In Copland.
  97. ;        FOR_SYSTEM8_COOPERATIVE                - Not in System 7.  In Copland, but only for cooperative tasks.
  98. ;        FOR_SYSTEM8_PREEMPTIVE                - Not in System 7.  In Copland.
  99. ;        
  100. ;        FOR_OPAQUE_SYSTEM_DATA_STRUCTURES    - Always true for system 8, but can be set by developer to
  101. ;                                              true or false for System 7.  When true, the contents of 
  102. ;                                              many system data structures are removed from the interfaces.
  103. ;                                              In the future, the Mac OS will have fewer data structures 
  104. ;                                              shared between applications and the system.  The problem
  105. ;                                              with shared data is 1) the system has to poll the data
  106. ;                                              to detect changes made by an application, 2) it prevents
  107. ;                                              data structures from being changed in the future.
  108. ;                                              Procedural interface will be used instead.
  109. ;                                              
  110. ;        FOR_PTR_BASED_AE                    - This is a temporary fix for Copland DR1.  It is needed to
  111. ;                                              distinguish between pointer based and handle based AppleEvents.
  112. ;                                              If you are in the case of BUILDING_FOR_SYSTEM7_AND_SYSTEM8
  113. ;                                              and want to use new pointer base AppleEvents, you will need to
  114. ;                                              -d FOR_PTR_BASED_AE on your compiler command line.
  115. ;        
  116. ;***************************************************************************************************
  117. ;
  118.     IF 0 THEN
  119. ;  extra if statement is to work around a bug in PPCAsm 1.2a2 
  120.     ELSEIF (&TYPE('BUILDING_FOR_SYSTEM7') <> 'UNDEFINED') THEN
  121.     IF &TYPE('FOR_OPAQUE_SYSTEM_DATA_STRUCTURES') = 'UNDEFINED' THEN
  122.     FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 0
  123.     ENDIF
  124.     FOR_PTR_BASED_AE: SET 0
  125.     FOR_SYSTEM7_ONLY: SET 1
  126.     FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 1
  127.     FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
  128.     FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
  129.     FOR_SYSTEM8_COOPERATIVE: SET 0
  130.     FOR_SYSTEM8_PREEMPTIVE: SET 0
  131.     ELSEIF (&TYPE('BUILDING_FOR_SYSTEM7_AND_SYSTEM8') <> 'UNDEFINED') THEN
  132.     IF &TYPE('FOR_OPAQUE_SYSTEM_DATA_STRUCTURES') = 'UNDEFINED' THEN
  133.     FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
  134.     ENDIF
  135.     IF &TYPE('FOR_PTR_BASED_AE') = 'UNDEFINED' THEN
  136.     FOR_PTR_BASED_AE: SET 0
  137.     ENDIF
  138.     FOR_SYSTEM7_ONLY: SET 0
  139.     FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 1
  140.     FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
  141.     FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
  142.     FOR_SYSTEM8_COOPERATIVE: SET 1
  143.     FOR_SYSTEM8_PREEMPTIVE: SET 1
  144.     ELSEIF (&TYPE('BUILDING_FOR_SYSTEM8') <> 'UNDEFINED') THEN
  145.     FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
  146.     FOR_PTR_BASED_AE: SET 1
  147.     FOR_SYSTEM7_ONLY: SET 0
  148.     FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 0
  149.     FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
  150.     FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
  151.     FOR_SYSTEM8_COOPERATIVE: SET 1
  152.     FOR_SYSTEM8_PREEMPTIVE: SET 1
  153.     ELSEIF (&TYPE('BUILDING_PREEMPTIVE_CODE') <> 'UNDEFINED') THEN
  154.     FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
  155.     FOR_PTR_BASED_AE: SET 1
  156.     FOR_SYSTEM7_ONLY: SET 0
  157.     FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 0
  158.     FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 0
  159.     FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
  160.     FOR_SYSTEM8_COOPERATIVE: SET 0
  161.     FOR_SYSTEM8_PREEMPTIVE: SET 1
  162.     ELSE
  163. ;  default is BUILDING_FOR_SYSTEM7_AND_SYSTEM8  
  164.     FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
  165.     IF &TYPE('FOR_PTR_BASED_AE') = 'UNDEFINED' THEN
  166.     FOR_PTR_BASED_AE: SET 0
  167.     ENDIF
  168.     FOR_SYSTEM7_ONLY: SET 0
  169.     FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 1
  170.     FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
  171.     FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
  172.     FOR_SYSTEM8_COOPERATIVE: SET 1
  173.     FOR_SYSTEM8_PREEMPTIVE: SET 1
  174.     ENDIF
  175. ;
  176. ;***************************************************************************************************
  177. ;
  178. ;    OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  179. ;                              (e.g. DisposPtr instead of DisposePtr). The names of system routine
  180. ;                              are now more sensitive to change because CFM binds by name.  In the 
  181. ;                              past, system routine names were compiled out to just an A-Trap.  
  182. ;                              Macros have been added that each map an old name to its new name.  
  183. ;                              This allows old routine names to be used in existing source files,
  184. ;                              but the macros only work if OLDROUTINENAMES is true.  This support
  185. ;                              will be removed in the near future.  Thus, all source code should 
  186. ;                              be changed to use the new names! You can set OLDROUTINENAMES to false
  187. ;                              to see if your code has any old names left in it.
  188. ;    
  189. ;    OLDROUTINELOCATIONS     - "Old" location of Macintosh system calls are used.  For example, c2pstr 
  190. ;                              has been moved from Strings to TextUtils.  It is conditionalized in
  191. ;                              Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
  192. ;                              This allows developers to upgrade to newer interface files without suddenly
  193. ;                              all their code not compiling becuase of "incorrect" includes.  But, it
  194. ;                              allows the slow migration of system calls to more understandable file
  195. ;                              locations.  OLDROUTINELOCATIONS currently defaults to true, but eventually
  196. ;                              will default to false.
  197. ;
  198. ;***************************************************************************************************
  199. ;
  200.     IF &TYPE('OLDROUTINENAMES') = 'UNDEFINED' THEN
  201.     OLDROUTINENAMES: SET 0
  202.     ENDIF
  203.     IF &TYPE('OLDROUTINELOCATIONS') = 'UNDEFINED' THEN
  204.     OLDROUTINELOCATIONS: SET 0
  205.     ENDIF
  206. ;
  207. ;***************************************************************************************************
  208. ;    IMPORT_CFM_FUNCTION     -    Macro used instead of IMPORT pseduo opcode because PowerPC
  209. ;                                and 68K CFM runtimes differ on naming of imported functions.
  210. ;                                PowerPC requires a period (.) in front of the name and CFM 68K
  211. ;                                does not.  This macros supplies the period for PowerPC.
  212. ;***************************************************************************************************
  213. ;
  214.     IF GENERATINGCFM THEN
  215.     IF GENERATINGPOWERPC THEN
  216.         Macro
  217.         IMPORT_CFM_FUNCTION        &functionName
  218.         IMPORT                    .&functionName
  219.         EndM
  220.     ELSE
  221.         Macro
  222.         IMPORT_CFM_FUNCTION        &functionName
  223.         IMPORT                    &functionName
  224.         EndM
  225.     ENDIF
  226.     ENDIF
  227.     ENDIF ; __CONDITIONALMACROS__ 
  228.  
  229.